#ifndef QUERY_H
#define QUERY_H

#include <QDialog>
#include <QMessageBox>
#include <QTableView>
#include <QHBoxLayout>
#include <QtGui>
#include <QString>
#include <QTextCodec>
#include <QSqlDatabase>
#include <QtSql>
#include "ui_query.h"
#include "base.h"


namespace Ui {
	class queryForm;
}

class queryForm : public QDialog
{
	Q_OBJECT

public:
	explicit queryForm(QWidget *parent = 0);
	~queryForm();

private:
	Ui::queryDidalog *ui;
	QSqlDatabase m_sqlSvrDb;
	QStringList m_colList;
	QStringList m_valueList;

	QRegExp m_rx;
	QValidator *m_validator;
	bool m_comHasOpened;
private slots:
	void showEvent();
	void closeEvent(QCloseEvent *e);
	void on_btn_openCom_clicked();
	void on_btn_closeCom_clicked();
	void on_btn_query_clicked();
	void on_btn_exit_clicked();
	void on_btn_writeMeterNo_clicked();

private:
	bool openSqlSvrDb();
	void closeSqlSvrDb();
};

#endif // !QUERY_H
